<?php
/**
* @version		$Id: default_viewfrontend.php 118 2012-10-02 08:52:27Z michel $
* @package		Cashestimation
* @subpackage 	Views
* @copyright	Copyright (C) 2013, . All rights reserved.
* @license #
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

 
class cashestimationViewestimationslist  extends JViewLegacy 
{
    
	public function display($tpl = null)
	{
		
            $app = &JFactory::getApplication();
            
            $task   = $app->input->get('task');// je récupère la tache à effectuer
            $data   = array();
            $model = new CashestimationModelEstimationslist();
            
           switch ($task) {
               case 'list_marque':
               {
                   $data    = $model->list_marque();
                   break;
               }
               case 'list_price':
               {
                   $data    = $model->list_price();
                   break;
               }

               default:
                   break;
           }
           
              // Get the document object.
            $document =& JFactory::getDocument();

            // Set the MIME type for JSON output.
            $document->setMimeEncoding('application/json');

            // Change the suggested filename.
            //JResponse::setHeader('Content-Disposition','attachment;filename="'.$view->getName().'.json"');

            // Output the JSON data.
            echo json_encode($data);

        }
		
		
}
